<template>
	<view>
		<!-- 搜索 -->
		<view class="cover-bg search-box">
			<image  src="../../../static/img/luo/search.png"></image>
			<input type="text" v-model="seachValue"  confirm-type="search" 
			placeholder="请输入姓名" value="" />
		</view>
		<!-- 收转人列表 -->
		<radio-group @change="checkboxChange">
			<view class="cover-bg list-box" v-for="items in filtransfereeList">
			<!-- 左 -->
			<view class="left-box">
				
					<label class="lb-items">
						<radio :value="items.name" />
					</label>
				
				<text class="lb-items name-logo">
					{{items.name.match(/\S{2}$/)[0]}}
				</text>
				<view class="lb-items name-box">
					<view class="name-top">
						<text>{{items.name}}</text>
						<image @click="callTransferee(items.phoneNumber)" src="../../../static/img/luo/tel.png" mode=""></image>
					</view>
					<view class="name-bottom">
						<text>{{items.skills.join(', ')}}</text>
					</view>
				</view>
			</view>
			<!-- 右 -->
			<view class="right-box">
				<text>距离用户{{items.distance}}m</text>
				<text>{{items.state}}</text>
			</view>
		</view>
		</radio-group>
		<!-- footer -->
		<view class="footer">
			<button type="primary" @click="meaksure">确定</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
				// 搜索
				seachValue:'',
				// 收转人列表
				transfereeList:[
				{
					id:0,
					name:'徐晓静',
					skills:['助医','清洁','陪护'],
					distance:'50',
					state:"空闲",
					phoneNumber:'13215165165',
					checked:false
				},
				{
					id:1,
					name:'徐2静',
					skills:['清洁','陪护'],
					distance:'250',
					state:"忙",
					phoneNumber:'13215685165',
					checked:false
				},
				],
				allNameList:[]
			}
		},
		
		computed:{
			//search
			filtransfereeList(){
				return this.transfereeList.filter((item)=>{
					return item.name.indexOf(this.seachValue) !==-1
				})
					
			}
		},
		methods: {
			// 呼叫
			callTransferee(value){
				// console.log('呼叫')
				uni.makePhoneCall({
				    phoneNumber: value //仅为示例
				})
			},
			//checkbox
			checkboxChange(e){
				// console.log(e.detail.value)
				this.allNameList=e.detail.value
				// console.log(this.allNameList)
			},
			// 确定
			meaksure(){
				// console.log(this.allNameList)
				uni.setStorage({
					key:'allNameList',
					data:this.allNameList,
					success:()=> {
						uni.navigateTo({
							url:`../transferForm/transferForm`
						})
					}
				})
			
				
			},
		},
	}
</script>

<style scoped>
.cover-bg{
		width: 91vw;
		margin: 20rpx 20rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		box-shadow: 0 1rpx 3rpx 0 #CDCDCD;
		border:2rpx solid #CDCDCD;
	}
	/* search */
	.search-box{
		/* width: 91vw; */
		display: flex;
		justify-content: flex-start;
		flex-direction: row;
		border: 2rpx solid #CDCDCD;
		margin: 20rpx;
		padding: 10rpx;
		align-items: center;
		border-radius: 10rpx;
		box-shadow: 0 0 1rpx 0 #CDCDCD;
	}
	.search-box image{
		width: 50rpx;
		height: 50rpx;
		margin-right: 10rpx;
	}
	/* list-box */
	.list-box{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		height: 150rpx;
	}
	/* 左 */
	.left-box{
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
		
	}
	.lb-items{
		margin-left: 15rpx;
	}
	.name-logo{
		background-color: #3776E5;
		border: 2rpx solid #3776E5;
		border-radius: 100%;
		width: 70rpx;
		height: 60rpx;
		padding: 20rpx;
		color: #ffffff;
		text-align: center;
		line-height: 60rpx;
	}
	.name-box{
		color: #878382;
		display: flex;
		justify-content: center;
		align-items: flex-start;
		flex-direction: column;
	}
	.name-top image{
		width: 25rpx;
		height: 25rpx;
		background-color: #00B9A1;
		border: 2rpx solid #00B9A1;
		border-radius: 100%;
		margin-left: 10rpx;
	}
	/* 右 */
	.right-box{
		color: #878382;
		display: flex;
		justify-content: center;
		align-items: flex-end;
		flex-direction: column;
		margin-right: 20rpx;
		font-size: 28rpx;
	}
	/* footer */
	.footer{
		margin: 15rpx;
	}
</style>
